import {
	bigint,
	bigserial,
	boolean,
	char,
	date,
	decimal,
	doublePrecision,
	integer,
	interval,
	json,
	jsonb,
	line,
	numeric,
	pgEnum,
	pgSchema,
	point,
	real,
	serial,
	smallint,
	smallserial,
	text,
	time,
	timestamp,
	uuid,
	varchar,
} from 'drizzle-orm/pg-core';

export const schema = pgSchema('seeder_lib_pg');

export const moodEnum = pgEnum('mood_enum', ['sad', 'ok', 'happy']);

export const allDataTypes = schema.table('all_data_types', {
	integer: integer('integer'),
	smallint: smallint('smallint'),
	biginteger: bigint('bigint', { mode: 'bigint' }),
	bigintNumber: bigint('bigint_number', { mode: 'number' }),
	serial: serial('serial'),
	smallserial: smallserial('smallserial'),
	bigserial: bigserial('bigserial', { mode: 'bigint' }),
	bigserialNumber: bigserial('bigserial_number', { mode: 'number' }),
	boolean: boolean('boolean'),
	text: text('text'),
	varchar: varchar('varchar', { length: 256 }),
	char: char('char', { length: 256 }),
	numeric: numeric('numeric'),
	decimal: decimal('decimal'),
	real: real('real'),
	doublePrecision: doublePrecision('double_precision'),
	json: json('json'),
	jsonb: jsonb('jsonb'),
	time: time('time'),
	timestampDate: timestamp('timestamp_date', { mode: 'date' }),
	timestampString: timestamp('timestamp_string', { mode: 'string' }),
	dateString: date('date_string', { mode: 'string' }),
	date: date('date', { mode: 'date' }),
	interval: interval('interval'),
	point: point('point', { mode: 'xy' }),
	pointTuple: point('point_tuple', { mode: 'tuple' }),
	line: line('line', { mode: 'abc' }),
	lineTuple: line('line_tuple', { mode: 'tuple' }),
	moodEnum: moodEnum('mood_enum'),
	uuid: uuid('uuid'),
});

export const allArrayDataTypes = schema.table('all_array_data_types', {
	integerArray: integer('integer_array').array(),
	smallintArray: smallint('smallint_array').array(),
	bigintegerArray: bigint('bigint_array', { mode: 'bigint' }).array(),
	bigintNumberArray: bigint('bigint_number_array', { mode: 'number' }).array(),
	booleanArray: boolean('boolean_array').array(),
	textArray: text('text_array').array(),
	varcharArray: varchar('varchar_array', { length: 256 }).array(),
	charArray: char('char_array', { length: 256 }).array(),
	numericArray: numeric('numeric_array').array(),
	decimalArray: decimal('decimal_array').array(),
	realArray: real('real_array').array(),
	doublePrecisionArray: doublePrecision('double_precision_array').array(),
	jsonArray: json('json_array').array(),
	jsonbArray: jsonb('jsonb_array').array(),
	timeArray: time('time_array').array(),
	timestampDateArray: timestamp('timestamp_date_array', { mode: 'date' }).array(),
	timestampStringArray: timestamp('timestamp_string_array', { mode: 'string' }).array(),
	dateStringArray: date('date_string_array', { mode: 'string' }).array(),
	dateArray: date('date_array', { mode: 'date' }).array(),
	intervalArray: interval('interval_array').array(),
	pointArray: point('point_array', { mode: 'xy' }).array(),
	pointTupleArray: point('point_tuple_array', { mode: 'tuple' }).array(),
	lineArray: line('line_array', { mode: 'abc' }).array(),
	lineTupleArray: line('line_tuple_array', { mode: 'tuple' }).array(),
	moodEnumArray: moodEnum('mood_enum_array').array(),
});

export const ndArrays = schema.table('nd_arrays', {
	integer1DArray: integer('integer_1d_array').array(3),
	integer2DArray: integer('integer_2d_array').array(3).array(4),
	integer3DArray: integer('integer_3d_array').array(3).array(4).array(5),
	integer4DArray: integer('integer_4d_array').array(3).array(4).array(5).array(6),
});

export const intervals = schema.table('intervals', {
	intervalYear: interval({ fields: 'year' }),
	intervalYearToMonth: interval({ fields: 'year to month' }),
	intervalMonth: interval({ fields: 'month' }),
	intervalDay: interval({ fields: 'day' }),
	intervalDayToHour: interval({ fields: 'day to hour' }),
	intervalDayToMinute: interval({ fields: 'day to minute' }),
	intervalDayToSecond: interval({ fields: 'day to second' }),
	intervalHour: interval({ fields: 'hour' }),
	intervalHourToMinute: interval({ fields: 'hour to minute' }),
	intervalHourToSecond: interval({ fields: 'hour to second' }),
	intervalMinute: interval({ fields: 'minute' }),
	intervalMinuteToSecond: interval({ fields: 'minute to second' }),
	intervalSecond: interval({ fields: 'second' }),
});
